package com.vshop.framework.web.autoconfig.cors;

import com.vshop.framework.core.constant.PropertiesConst;
import com.vshop.framework.core.util.StringConst;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 跨域配置属性
 */
@Data
@ConfigurationProperties(PropertiesConst.WebCors)
public class CorsProperties {

    private static final List<String> ALL = Collections.singletonList(StringConst.ASTERISK);

    /**
     * 是否启用跨域配置
     */
//    private boolean enabled = true;

    /**
     * 允许跨域的域名
     */
    private List<String> allowedOrigins = new ArrayList<>(ALL);

    /**
     * 允许跨域的请求方式
     */
    private List<String> allowedMethods = new ArrayList<>(ALL);

    /**
     * 允许跨域的请求头
     */
    private List<String> allowedHeaders = new ArrayList<>(ALL);

    /**
     * 允许跨域的响应头
     */
    private List<String> exposedHeaders = new ArrayList<>();
}
